using Holoville.HOTween;
using UnityEngine;

public class WindowLostMissionMsg : MonoBehaviour
{
	private MissionBase curMission;

	[SerializeField]
	private UILabel lbTitelMission;

	private UIPanel widjet;

	private void Awake()
	{
		HOTween.Init();
		if (widjet == null)
		{
			widjet = GetComponent<UIPanel>();
		}
		widjet.alpha = 0f;
	}

	public void ShowWindow(bool value)
	{
		MyMiniTween[] componentsInChildren = GetComponentsInChildren<MyMiniTween>();
		foreach (MyMiniTween myMiniTween in componentsInChildren)
		{
			myMiniTween.Show(value);
		}
		HOTween.Kill(widjet);
		HOTween.To(widjet, 0.2f, new TweenParms().UpdateType(UpdateType.TimeScaleIndependentUpdate).Prop("alpha", (!value) ? 0f : 1f));
	}

	public void Hide()
	{
		ShowWindow(false);
		Time.timeScale = 1f;
	}

	public void Restart()
	{
		ManagerMissions.instance.startedMission[0].ResetMission();
		Hide();
	}

	public void QuitMission()
	{
		Hide();
		ManagerMissions.instance.StopAllMission();
	}

	public void UpdateParametrMission(MissionBase needMis = null)
	{
		curMission = needMis;
		lbTitelMission.text = curMission.title;
	}
}
